<template>
	<view class="ffffff">
		<view class="mainpadding ffffff flexbetween border">
			<view class="titletext lefttitle bold hei_text">客户名称</view>
			<input type="text" class="main_size hei_text rightcontent " placeholder="请输入"  v-model="name">
		</view>
		<view class="mainpadding_top ffffff flexbetween border">
			<view class="titletext lefttitle bold hei_text">姓名</view>
			<input type="text" class="main_size hei_text rightcontent " placeholder="请输入"  v-model="username">
		</view>
		<view class="mainpadding_top ffffff flexbetween border">
			<view class="titletext lefttitle bold hei_text">支付宝号</view>
			<input type="text" class="main_size hei_text rightcontent " placeholder="请输入"  v-model="wechat_code">
		</view>
		<view class="mainpadding_top ffffff flexbetween border">
			<view class="titletext lefttitle bold hei_text">微信号</view>
			<input type="text" class="main_size hei_text rightcontent " placeholder="请输入"  v-model="ali_account">
		</view>
		<view class="mainpadding_top ffffff flexbetween border">
			<view class="titletext lefttitle bold hei_text">营业执照信用代码</view>
			<input type="text" class="main_size hei_text rightcontent " placeholder="请输入"  v-model="yyzz_code">
		</view>
		<view class="mainpadding_top ffffff flexbetween border">
			<view class="titletext lefttitle bold hei_text">省市区</view>
			<uni-data-picker :localdata="items" placeholder="请选择住址" popup-title="请选择地区" v-model="addressinfo.county"
				@change="bindPickerChange">
				<view class="flexbetween rightcontent">
					<input type="text" class="main_size hei_text margin_rignt" disabled="" placeholder="请选择"  v-model="cityInfo">
					<u-icon name="arrow-right" color="#999" size="16"></u-icon>
				</view>
			</uni-data-picker>
			
		</view>
		<view class="mainpadding_top ffffff flexbetween border">
			<view class="titletext lefttitle bold hei_text">详细地址</view>
			<view class="flexbetween rightcontent" @click="getLocation">
				<input type="text" class="main_size hei_text margin_rignt" disabled="" placeholder="请选择"  v-model="address">
				<u-icon name="map" color="#999" size="16"></u-icon>
			</view>
		</view>
		<view class="mainpadding_top ffffff flexbetween border">
			<view class="titletext lefttitle bold hei_text">发票抬头</view>
			<input type="text" class="main_size hei_text rightcontent " placeholder="请输入"  v-model="fptt">
		</view>
		<view class="mainpadding_top ffffff flexbetween border">
			<view class="titletext lefttitle bold hei_text">财务联系电话</view>
			<input type="text" class="main_size hei_text rightcontent " placeholder="请输入"  v-model="cw_mobile">
		</view>
		<view class="mainpadding_top ffffff flexbetween border">
			<view class="titletext lefttitle bold hei_text">纳税人识别号</view>
			<input type="text" class="main_size hei_text rightcontent " placeholder="请输入"  v-model="nsrsbh">
		</view>
		<view class="mainpadding_top ffffff flexbetween border">
			<view class="titletext lefttitle bold hei_text">开户行</view>
			<input type="text" class="main_size hei_text rightcontent " placeholder="请输入"  v-model="open_bank">
		</view>
		<view class="mainpadding_top ffffff flexbetween border">
			<view class="titletext lefttitle bold hei_text">银行账号</view>
			<input type="text" class="main_size hei_text rightcontent " placeholder="请输入"  v-model="bank_account">
		</view>
		<view class="mainpadding_top ffffff flexbetween border">
			<view class="titletext lefttitle bold hei_text">信用额度</view>
			<input type="text" class="main_size hei_text rightcontent " placeholder="请输入"  v-model="xyed_price">
		</view>
		<view class="mainpadding_top ffffff flexbetween border">
			<view class="titletext lefttitle bold hei_text">联系电话</view>
			<input type="text" class="main_size hei_text rightcontent " placeholder="请输入"  v-model="mobile">
		</view>
		<view class="mainpadding">
			<view class="submitbtn" @click="submit">确定</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require('@/commonFun/httpRequest.js');
	import citys from "@/static/city/city.js"
	export default {
		data() {
			return {
				name:"",
				username:"",
				wechat_code:"",
				ali_account:"",
				yyzz_code:"",
				custom_area_id:"",
				address:"",
				fptt:"",
				cw_mobile:"",
				nsrsbh:"",
				open_bank:"",
				bank_account:"",
				xyed_price:"",
				mobile:"",
				latitude:"",
				longitude:"",
				addressinfo: {
					province: "",
					city: "",
					county: ""
				},
				items: [],
				cityInfo: [], //收获地址
			};
		},
		onLoad() {
			this.items = JSON.parse(JSON.stringify(citys.data))
		},
		methods: {
			bindPickerChange(val) {
				let area = val.detail.value
				this.cityInfo = [area[0].text, area[1].text, area[2].text];
				this.addressinfo.province = area[0].value;
				this.addressinfo.city = area[1].value;
				this.addressinfo.county = area[2].value;
			},
			getLocation() {
				let _this = this
				uni.chooseLocation({
					success: function(res) {
						console.log('位置:',res);
						_this.address = res.address.replace(/.+?(省|市|自治区|自治州|县|区)/g, '');
						_this.longitude = res.longitude
						_this.latitude = res.latitude
					}
				})
			},
		}
	};
</script>

<style scoped lang="scss">
	.border{
		border-bottom: 1rpx solid rgba(0, 0, 0 ,.01);
	}
	.lefttitle{
		flex: 3.3;
	}
	.rightcontent{
		flex: 5;
		width: 100%;
	}
</style>
